package converter;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import repository.ProfileRepository;
import domain.Profile;

@Component
public class ProfileConverter implements Converter<String, Profile>{
	
	private ProfileRepository profileRepository;
	
	@Autowired
	public ProfileConverter(ProfileRepository profileRepository) {
		this.profileRepository = profileRepository;
	}

	@Override
	public Profile convert(String source) {
		return profileRepository.getProfile(Integer.valueOf(source));
	}

}
